<?php

namespace App\Repository;

use Hyperf\Context\Context;

class RepositoryGeneral
{
    protected bool $continue = false;

    protected function toArray($data): array
    {
        if ($data instanceof \stdClass) {
            return (array)$data;
        }
        return empty($data) ? [] : $data->toArray();
    }


    public static function getInc()
    {
        $classInstance = Context::get(static::class);
        if (empty($classInstance)) {
            $classInstance = new static();
            Context::set(static::class,$classInstance);
        }
        return $classInstance;
    }

    public function isContinue(): bool
    {
        return $this->continue;
    }

    public function setContinue(bool $value): void
    {
        $this->continue = $value;
    }


}